package com.inwavetech.os.util;

import java.util.HashMap;

/**
 * Created by jgskin on 2/11/14.
 */
public class EnumHandler {

    private final HashMap<Integer, Enum> a;
    private final HashMap<Enum, Integer> b;

    public EnumHandler(HashMap<Integer, Enum> a) {
        this.a = a;
        this.b = new HashMap<Enum, Integer>();

        for (Integer id: a.keySet()) {
            b.put(a.get(id), id);
        }
    }

    public Enum getEnum(Integer id) {
        return a.get(id);
    }

    public Integer getId(Enum type) {
        if (type != null) {
            return b.get(type);
        }

        return null;
    }

}
